(function(t){if(typeof BX.DragDrop!=="undefined")return;BX.DragDrop=function(t){this.dragItemControlClassName=t.dragItemControlClassName||null;this.dragNodeList=document.body.querySelectorAll("."+t.dragItemClassName);this.dragStartCallback=t.dragStart||null;this.dragCallback=t.drag||null;this.dragOverCallback=t.dragOver||null;this.dragEnterCallback=t.dragEnter||null;this.dragLeaveCallback=t.dragLeave||null;this.dragDropCallback=t.dragDrop||null;this.dragEndCallback=t.dragEnd||null;this.dragActiveClass=t.dragActiveClass||null;this.activeDragElement=null;this.isDocDragover=false;this.isAutoScroll=false;this.scrollIntervalID=0;this.isScrollInterval=false;this.isSortable=false;this.isSortableActive=false;if(typeof t.dropZoneList=="string")this.dropZoneNodeList=document.body.querySelectorAll("."+t.dropZoneList);else if(BX.type.isArray(t.dropZoneList))this.dropZoneNodeList=t.dropZoneList;else if(BX.type.isDomNode(t.dropZoneList))this.dropZoneNodeList=[t.dropZoneList];if(typeof t.sortable=="object"){var e=t.sortable.className?document.body.querySelectorAll("."+t.sortable.className):this.dragNodeList;var s=BX.convert.nodeListToArray(e);this.sortable={rootElem:t.sortable.rootElem,gagClass:t.sortable.gagClass,gagHtml:t.sortable.gagHtml||"",list:s,floating:/left|right|inline/.test(BX.style(s[0],"float")+BX.style(s[0],"display")),node:t.sortable.node||null,isNode:false};if(this.sortable.node)this.sortable.isNode=true;this.isSortable=true}this.dragEventX=0;this.dragEventY=0;this.scroll={edgeBottom:0,edgeTop:0,edgeLeft:0,edgeRight:0,height:0,width:0,visibleHeight:0,visibleWidth:0,speedX:10,speedY:10,prevPosDragEvY:-1,prevPosDragEvX:-1};this.isIE=document.documentMode&&document.documentMode<=9||false;this._bind()};BX.DragDrop.prototype={_bind:function(){if(this.dragNodeList&&this.dragNodeList.length>0)this.bindDragItem(this.dragNodeList);if(this.dropZoneNodeList&&this.dropZoneNodeList.length>0)this.bindCatcher(this.dropZoneNodeList)},bindDragItem:function(e){var s=this;var i=null;for(var l=e.length-1;l>=0;l--){i=null;if(this.dragItemControlClassName){i=e[l].querySelector("."+this.dragItemControlClassName);i=BX(i)}if(!i){i=e[l]}i.draggable=true;if(this.isIE){BX.bind(i,"selectstart",function(e){e=e||t.event;BX.PreventDefault(e);s.onSelect(e,this)})}BX.bind(i,"dragstart",BX.delegate(function(e){e=e||t.event;s.ondragStart(e,this)},e[l]));BX.bind(i,"drag",BX.proxy(this.ondrag,this));BX.bind(i,"dragend",BX.delegate(function(e){e=e||t.event;s.ondragEnd(e,this)},e[l]))}},bindCatcher:function(e){var s=this;for(var i=e.length-1;i>=0;i--){BX.bind(e[i],"dragover",function(e){if(s.isAutoScroll){e=e||t.event;s.dragEventX=e.clientX;s.dragEventY=e.clientY}BX.PreventDefault(e);e.dataTransfer.dropEffect="move";s.ondragOver(e,this)});BX.bind(e[i],"dragenter",function(e){e=e||t.event;BX.PreventDefault(e);s.ondragEnter(e,this)});BX.bind(e[i],"dragleave",function(e){e=e||t.event;BX.PreventDefault(e);s.ondragLeave(e,this)});BX.bind(e[i],"drop",function(e){e=e||t.event;BX.PreventDefault(e);s.ondragDrop(e,this)})}},addSortableItem:function(t){this.sortable.list.push(t)},removeSortableItem:function(t){for(var e=0;e<this.sortable.list.length;e++){if(this.sortable.list[e]==t)delete this.sortable.list[e]}},addDragItem:function(t){this.bindDragItem(t)},addCatcher:function(t){this.dropZoneNodeList.push(t);this.bindCatcher([t])},removeCatcher:function(t){for(var e=this.dropZoneNodeList.length-1;e>=0;e--){if(this.dropZoneNodeList[e]==t)delete this.dropZoneNodeList[e]}},onSelect:function(t,e){e.dragDrop();return false},ondragStart:function(e,s){e=e||t.event;e.dataTransfer.setData("text","");e.dataTransfer.effectAllowed="move";this.activeDragElement=s;if(document.body.scrollHeight>document.body.clientHeight||document.body.scrollWidth>document.body.clientWidth)this.setAutoScroll(e.clientX,e.clientY);if(this.dragActiveClass){setTimeout(BX.proxy(function(){BX.addClass(this.activeDragElement,this.dragActiveClass)},this),10)}var i={dragElement:this.activeDragElement,sortableElement:this.sortable&&this.sortable.node?this.sortable.node:null,event:e};if(this.isSortable&&!this.isSortableActive){if(!this.sortable.isNode){this.sortable.node=this.activeDragElement;this.sortable.gagClass?setTimeout(BX.proxy(function(){BX.addClass(this.sortable.node,this.sortable.gagClass)},this),50):null}this.isSortableActive=true;this.sortableInterval=setInterval(BX.proxy(this.sortableMove,this),100)}if(typeof this.dragStartCallback=="function")this.dragStartCallback(i)},setAutoScroll:function(t,e){var s=BX.pos(this.activeDragElement),i=s.bottom,l=s.top,r=s.left,o=s.right,a=document.documentElement.scrollTop||document.body.scrollTop,n=document.documentElement.scrollLeft||document.body.scrollLeft;this.scroll.visibleHeight=document.body.clientHeight;this.scroll.visibleWidth=document.body.clientWidth;this.scroll.edgeBottom=this.scroll.visibleHeight+a-(i-e);this.scroll.edgeTop=a+(e-l);this.scroll.edgeLeft=n+(t-r);this.scroll.edgeRight=this.scroll.visibleWidth+n-(o-t);this.scroll.height=document.body.scrollHeight;this.scroll.width=document.body.scrollWidth;this.scroll.prevPosDragEvY=e;this.scroll.prevPosDragEvX=t;this.isAutoScroll=true},sortableMove:function(){var t=document.elementFromPoint(this.dragEventX,this.dragEventY);if(t===null){return}var i=this.sortable.node;while(t!==null&&t!=document.body){for(var l=this.sortable.list.length-1;l>=0;l--){if(t==this.sortable.list[l]){i=this.sortable.list[l];break}}t=t.parentNode}var r=false,o=false,a=i,n=i,d=e(i),h=i==this.sortable.node,c=i.getBoundingClientRect(),g=this.sortable.node.getBoundingClientRect(),v=0,f;while((a||n)&&!h){if(a)a=e(a);if(n)n=s(n);if(a==this.sortable.node||n==this.sortable.node){r=a==this.sortable.node;o=n==this.sortable.node;break}}if(!h&&o){if(this.sortable.floating){v=c.right-(g.right-g.left);f=this.dragEventX}else{v=c.bottom-(g.bottom-g.top);f=this.dragEventY}if(d&&f>v){this.sortable.rootElem.insertBefore(this.sortable.node,i.nextSibling)}else if(!d&&f>v){this.sortable.rootElem.appendChild(this.sortable.node)}}else if(!h&&r){if(this.sortable.floating){v=c.left+(g.right-g.left);f=this.dragEventX}else{v=c.top+(g.bottom-g.top);f=this.dragEventY}if(d&&f<v){this.sortable.rootElem.insertBefore(this.sortable.node,i)}else if(!d&&f<v){this.sortable.rootElem.appendChild(this.sortable.node)}}},ondrag:function(e){var s=e||t.event;var i=s.clientY===0||s.clientX===0||false;if(!this.isDocDragover&&i){BX.bind(document,"dragover",BX.proxy(this._ondrag,this));this.isDocDragover=true}else if(s.clientY>0||s.clientX>0){this.dragEventX=s.clientX;this.dragEventY=s.clientY;if(!this.isScrollInterval){this.scrollIntervalID=setInterval(BX.proxy(this.autoScrollScroll,this),50);this.isScrollInterval=true}}if(typeof this.dragCallback=="function"){setTimeout(BX.proxy(function(){if(i){s.clientFFX=this.dragEventX;s.clientFFY=this.dragEventY}this.dragCallback(this.activeDragElement,this.sortable?this.sortable.node:null,s)},this),0)}},_ondrag:function(t){this.dragEventX=t.clientX;this.dragEventY=t.clientY;if(!this.isScrollInterval&&this.isAutoScroll){this.scrollIntervalID=setInterval(BX.proxy(this.autoScrollScroll,this),50);this.isScrollInterval=true}},autoScrollScroll:function(){var e=document.documentElement.scrollTop||document.body.scrollTop;var s=document.documentElement.scrollLeft||document.body.scrollLeft;var i=this.scroll.prevPosDragEvX>=this.dragEventX||false;var l=this.scroll.prevPosDragEvX<=this.dragEventX||false;var r=this.scroll.prevPosDragEvY>=this.dragEventY||false;var o=this.scroll.prevPosDragEvY<=this.dragEventY||false;if(s>0&&this.dragEventX<=this.scroll.edgeLeft&&i){s-=this.scroll.speedX;t.scrollTo(s,e);if(this.scroll.speedX<100)this.scroll.speedX+=1;this.scroll.prevPosDragEvX=this.dragEventX}else if(s+this.scroll.visibleWidth<this.scroll.width&&this.dragEventX>=this.scroll.edgeRight&&l){s+=this.scroll.speedX;t.scrollTo(s,e);if(this.scroll.speedX<100)this.scroll.speedX+=1;this.scroll.prevPosDragEvX=this.dragEventX}else{this.scroll.speedX=15}if(e>0&&this.dragEventY<=this.scroll.edgeTop&&r){e-=this.scroll.speedY;t.scrollTo(s,e);if(this.scroll.speedY<100)this.scroll.speedY+=1;this.scroll.prevPosDragEvY=this.dragEventY}else if(e+this.scroll.visibleHeight<this.scroll.height&&this.dragEventY>=this.scroll.edgeBottom&&o){e+=this.scroll.speedY;t.scrollTo(s,e);if(this.scroll.speedY<100)this.scroll.speedY+=1;this.scroll.prevPosDragEvY=this.dragEventY}else{this.scroll.speedY=10}},ondragOver:function(t,e){if(typeof this.dragOverCallback=="function")this.dragOverCallback(e,this.activeDragElement,t)},ondragEnter:function(t,e){if(typeof this.dragEnterCallback=="function")this.dragEnterCallback(e,this.activeDragElement,t)},ondragLeave:function(t,e){if(typeof this.dragLeaveCallback=="function")this.dragLeaveCallback(e,this.activeDragElement,t)},ondragDrop:function(t,e){if(typeof this.dragDropCallback=="function")this.dragDropCallback(e,this.activeDragElement,t)},ondragEnd:function(t,e){clearInterval(this.scrollIntervalID);this.isScrollInterval=false;this.isSortableActive=false;if(this.sortable&&this.sortable.gagClass)BX.removeClass(this.sortable.node,this.sortable.gagClass);BX.unbind(document,"dragover",BX.proxy(this._ondrag,this));this.isDocDragover=false;if(typeof this.dragEndCallback=="function"){this.dragEndCallback(e,this.sortable?this.sortable.node:null,t)}if(this.dragActiveClass){setTimeout(BX.proxy(function(){BX.removeClass(this.activeDragElement,this.dragActiveClass)},this),0)}clearInterval(this.sortableInterval)}};BX.DragDrop.create=function(t){return new BX.DragDrop(t)};function e(t){if(document.documentElement.nextElementSibling!==undefined){return t.nextElementSibling}else{var e=t.nextSibling;while(e&&e.nodeType!=1){e=e.nextSibling}return e}}function s(t){if(document.documentElement.previousElementSibling!==undefined){return t.previousElementSibling}else{var e=t.previousSibling;while(e&&e.nodeType!=1){e=e.previousSibling}return e}}})(window);
//# sourceMappingURL=core_dragdrop.map.js